using System;
using System.Collections.ObjectModel;
using WcfService1.DTO;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace WcfService1.DTO
{
    [DataContract]
    public class SaldoAwalHutang 
    {
        private SupplierDTO _Supplier;
        private string _InvoiceNo;
        private decimal _Saldo;
        private ObservableCollection<SupplierDTO> _Suppliers;
        private CoaDTO _Coa;


        [DataMember]
        public SupplierDTO Supplier
        {
            get { return _Supplier; }
            set
            {
                if (ReferenceEquals(_Supplier,value) || value == null)return;
                _Supplier = value;
                RaisePropertyChanged("Supplier");
            }
        }

         [DataMember]
         public CoaDTO Coa
         {
             get { return _Coa; }
             set
             {
                 if (ReferenceEquals(_Coa, value) || value == null) return;
                 _Coa = value;
                 RaisePropertyChanged("Coa");
             }
         }

        public ObservableCollection<SupplierDTO> Suppliers
        {
            get { return _Suppliers; }
            set
            {
                if (ReferenceEquals(_Suppliers, value) || value == null) return;
                _Suppliers = value;
                RaisePropertyChanged("Suppliers");
            }
        }

         [DataMember]
        public String InvoiceNo
        {
            get { return _InvoiceNo; }
            set
            {
                if (InvoiceNo == value)return;
                _InvoiceNo = value;
                RaisePropertyChanged("InvoiceNo");
            }
        }


        [DataMember]
        public decimal Saldo
        {
            get { return _Saldo;  }
            set
            {
                if (Saldo == value)return;
                _Saldo = value;
                RaisePropertyChanged("Saldo");
            }
        }


        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        protected void RaisePropertyChanged(string propertyname)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyname));
        }
    }
}